﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ABCLogistic_System_V2._0.BL
{
    class LoadandCloseForm
    {
        /// <summary>
        /// dong form khi load form moi
        /// </summary>
        /// <param name="closeform"></param>
        public void CloseForm(Form closeform)
        {
            if (closeform != null) closeform.Close();
        }

        /// <summary>
        /// an form khi mo form moi
        /// </summary>
        /// <param name="closeform"></param>
        public void HideForm(Form hideform)
        {
            if (hideform != null) hideform.Hide();
        }

        #region Xu ly cac truong hop thoat chuong trinh
        /// <summary>
        /// xet du lieu trong cac textbox co du lieu thi thong bao va dong hoac dang nhap
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void FormClosing(object sender, FormClosingEventArgs e)
        {
                DialogResult result = MessageBox.Show("Bạn muốn thoát?", "Thông báo!", MessageBoxButtons.YesNo,MessageBoxIcon.Warning);
                if (result == DialogResult.No)
                {
                    e.Cancel = true;
                }
                else e.Cancel = false;
        }
        #endregion

    }
}
